// pages/index/Share/ShareHotMoney.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo:[],
    options:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that  = this;
    console.log(options);
    that.setData({
      options: options,
      userInfo: app.globalData.userInfo,
    })
    if (options.style == 1) {
      wx.navigateTo({
        url: "./share?Money=" + that.data.options.Money
        + "&Number=" + that.data.options.Number
        + "&kouling=" + that.data.options.kouling
        + "&houBaoStyle=" + that.data.options.houBaoStyle,
      })
    }
  },
  tosharePic:function(options){
    var that = this;
    console.log("正在执行sharePic。准被跳转到生成图片")
    wx.navigateTo({
      url: './sharePic',
    }) 
  },
  toShare:function(){
    var that = this;
    wx.navigateTo({
      url: './share?houBaoStyle=' + that.data.options.houBaoStyle
      + "&Money=" + that.data.options.Money
      + "&Number=" + that.data.options.Number
      + "&kouling=" + that.data.options.kouling,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
   
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  onShareAppMessage: function (res) {
    var that = this;
    console.log("开始执行转发")
    return {
      title:"小程序红包",
      path: "/pages/index/Share/ShareHotMoney?Money=" + that.data.options.Money
      + "&Number=" + that.data.options.Number
      + "&kouling=" + that.data.options.kouling
      + "&houBaoStyle=" + that.data.options.houBaoStyle
      + "&style=1"
      + "&orderno="+ that.data.options.orderno,
      success:function(res){
        app.showInfo("转发成功")
        console.log(res)
        that.toShare();
      },
      fail:function(res){
        app.showInfo("转发失败")
        console.log(res)
      }

    }
  }
})